<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>审批列表</title>

    <%include ../../common.ejs%>

    <script type="text/javascript" src="/javascripts/sweet-alert.js"></script>
    <link rel="stylesheet" type="text/css" href="/stylesheets/sweet-alert.css">
    <style>
        ._label-color {
            color: white;
            text-decoration: none;
            font-weight: bold;
        }

        .table-div .caption {
            font-size: 30px;
        }

        .input-costom {

            width: 130px;
        }
    </style>

    <script type="text/javascript">

        function confirms(id) {
            swal({
                        title: "是否删除该活动？",
                        test: "test",
                        type: "warning",
                        showCancelButton: true,
                        confirmButtonColor: '#DD6B55',
                        confirmButtonText: '删除',
                        cancelButtonText: "保留",
                        closeOnConfirm: false,
                        closeOnCancel: true
                    },

                    function (isConfirm) {
                        var activityId = id;
                        if (isConfirm) {
                            swal("Deleted!", "Your imaginary file has been deleted.", "success");
                            window.location.href = "delActivityList?id=" + activityId;
                        }
                    });
        }
        ;

        var queryApplyInvited = function(){
            $.ajax({
                type: "POST",
                url: "/admin/examappr/queryExamAppr",
                data: "name=John&location=Boston",
                success: function(msg){
                    alert( "Data Saved: " + msg );
                }
            });
//            alert(1);
        }
    </script>
</head>
<body>
<div id="top">
    <% include ../top.ejs%>
</div>
<div class="container-fluid" style="margin-top: 20px;">
    <div class="row">
        <div class="col-md-1">
        </div>
        <div id="left" class="col-md-2">
            <% include ../left.ejs%>
        </div>
        <div class="col-md-8 bodyDiv" id="right">

            <div class="table-div">
                <span class="caption" >审批列表</span>

                <div class="row">
                    <form class="form-horizontal" action="/admin/examappr/examAppr" role="form" method="get">
                        <div class="col-md-6"></div>
                        <div class="col-md-2">

                            <div class="dropdown">
                                <select class="form-control">
                                    <option value="活动主题">活动主题</option>
                                </select>
                            </div>
                        </div>
                        <div class="col-md-2  input-costom ">
                            <input type="text" name="subject" class="form-control" value="<%= param%>">
                        </div>
                        <div class="col-md-2">
                            <button type="submit" class="btn btn-default" onclick="queryApplyInvited()">搜索</button>
                        </div>
                    </form>
                </div>
                <table class="table table-striped table-condensed">
                    <thead>
                    <tr>
                        <th>活动名称</th>
                        <th>客户姓名</th>
                        <th>申请时间</th>
                        <th>活动状态</th>
                        <th>邀请/报名状态</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <% for(var i=0; i
                    <examApprs.length
                    ; i++) { %>
                    <tr>
                        <td><a href="/admin/activityManage/toActivityDetail?id=<%= examApprs[i].activeId %>"><%=
                            examApprs[i].subject %></a></td>
                        <td><a href="#"><%= examApprs[i].name %></a></td>
                        <td><%= examApprs[i].applyTime %></td>
                        <% if(examApprs[i].activeStatus == 1){ %>
                        <td>未开始</td>
                        <% } %>
                        <% if(examApprs[i].activeStatus == 2){ %>
                        <td>进行中</td>
                        <% } %>
                        <% if(examApprs[i].activeStatus == 3){ %>
                        <td>已结束</td>
                        <% } %>
                        <% if(examApprs[i].admitStatus == 1){ %>
                        <td>邀请未确认</td>
                        <% } %>
                        <% if(examApprs[i].admitStatus == 2){ %>
                        <td>邀请同意</td>
                        <% } %>
                        <% if(examApprs[i].admitStatus == 3){ %>
                        <td>邀请被拒绝</td>
                        <% } %>
                        <% if(examApprs[i].admitStatus == 4){ %>
                        <td>申请未审核</td>
                        <% } %>
                        <% if(examApprs[i].admitStatus == 5){ %>
                        <td>申请已批准</td>
                        <% } %>
                        <% if(examApprs[i].admitStatus == 6){ %>
                        <td>申请被拒绝</td>
                        <% } %>
                        <% if(examApprs[i].admitStatus == 7){ %>
                        <td>未出席</td>
                        <% } %>
                        <% if(examApprs[i].admitStatus == 8){ %>
                        <td>已出席</td>
                        <% } %>

                        <% //审核邀请操作 %>
                        <% if(examApprs[i].activeStatus == 1){%>
                        <% if(examApprs[i].admitStatus == 4){ %>
                        <td>
                            <a href="/admin/examappr/changeAdmitStatus?param=status;5;id;<%= examApprs[i].admitId %>">通过</a>&nbsp;&nbsp;
                            <a href="/admin/examappr/changeAdmitStatus?param=status;6;id;<%= examApprs[i].admitId %>">拒绝</a>&nbsp;&nbsp;
                        </td>
                        <% }else if(examApprs[i].admitStatus == 1){%>
                        <td><a href="/admin/examappr/cancelInvited?id=<%= examApprs[i].admitId %>">取消邀请</a>&nbsp;&nbsp;&nbsp;
                        </td>
                        <% }else{ %>
                        <td>
                            <span>&nbsp;&nbsp;&nbsp;&nbsp;<!--不可操作--></span>
                        </td>
                        <% } %>
                        <% } else{ %>
                        <td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
                        <% } %>
                    </tr>
                    <% } %>

                    </tbody>
                </table>

            </div>
            <div class="row">
                <div class="col-md-4"></div>
                <div class="col-md-6">
                    <ul class="pagination">
                        <li><a href="#">&laquo;</a></li>
                        <li><a href="#">1</a></li>
                        <li><a href="#">2</a></li>
                        <li><a href="#">3</a></li>
                        <li><a href="#">4</a></li>
                        <li><a href="#">5</a></li>
                        <li><a href="#">&raquo;</a></li>
                    </ul>
                </div>

            </div>

        </div>

    </div>
</div>
</div>
<div id="bottom"></div>
</body>
</html>